import {createWebHashHistory, createRouter, createWebHistory} from 'vue-router'

import HomeView from '../page/Home.vue'
import CodeView from '../page/Code.vue'

const routes = [
    { path: '/', component: HomeView },
    {
        path: '/code',
        component: CodeView ,
        children: [
            {
                name: 'auto',
                path: '/auto',
                component: () => import('../components/Auto.vue'),
                meta: {
                    title: '自动化',
                },
            },
            {
                name: 'event',
                path: '/event',
                component: () => import('../components/Event.vue'),
                meta: {
                    title: '事件',
                },
            },
            {
                name: 'codeEdit',
                path: '/codeEdit',
                component: () => import('../components/CodeEdit.vue'),
                meta: {
                    title: '编程',
                },
            }, {
                name: 'pullData',
                path: '/pullData',
                component: () => import('../components/PullData.vue'),
                meta: {
                    title: '数据提交',
                },
            },
        ]
    },


]

const router = createRouter({
    history: import.meta.env.DEV ? createWebHistory() : createWebHashHistory(),
    routes,

})

export default router
